package org.laptech.calculator;

import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.util.TypedValue;
import android.widget.ImageView;

/**
 * Created by rlapin on 27.11.14.
 */
public class SpellImageView extends ImageView{
    char hotkey;
    public SpellImageView(char hotkey, MainActivity mainActivity) {
        super(mainActivity);
        this.hotkey = hotkey;
    }

    @Override
    public void draw(Canvas canvas) {
        super.draw(canvas);
        Paint paint = new Paint();
        paint.setColor(Color.YELLOW);
        int px = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,16,getResources().getDisplayMetrics());
        paint.setTextSize(px);
        if(hotkey!=0)
            canvas.drawText("("+hotkey+")",getWidth()-px*1.5f,px,paint);
    }
}
